<template>
  <div>
    <breal></breal>
    <el-card>
      <el-row>
        <el-col>
          <el-button type="primary">添加用户</el-button>
        </el-col>
      </el-row>
      <!-- 表格 -->
      <tree-table
        :data="tableData"
        :columns="columns"
        :selection-type="false"
        :expand-type="false"
        show-index
        index-text="#"
        border
      ></tree-table>
    </el-card>
  </div>
</template>
<script>
import breal from "../Bread";
export default {
  components: {
    breal
  },
  data() {
    return {
      columns: [{ label: "分类名称", prop: "cat_name" }]
    };
  },
  created() {
    this.addForm();
  },
  methods: {
    async addForm() {
      const res = await this.$http.get("categories");
      console.log(res);
      let { data, meta } = res.data;
      if (meta.status == 200) {
        this.tableData = data;
        this.total = data.total;
      }
    }
  }
};
</script>
<style lang="scss">
</style>
